package leetcode.lt100;

class Solution_53 {
	public int maxSubArray(int[] nums) {
		int temp = 0;
		int max = nums[0];
		int l = nums.length;
		for (int i = 0; i < l; i++) {
			if (temp < 0) {
				temp = 0;
			}
			temp += nums[i];
			max = Math.max(max, temp);
		}

		return max;
	}
}